package com.sanshi.project.admin.api.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.github.yulichang.annotation.EntityMapping;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 租赁合同
 *
 * @author nikon
 * @date 2023-11-27 08:46:34
 */
@Data
@TableName("contract")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "租赁合同")
public class ContractEntity extends Model<ContractEntity> {


    /**
     * 主键
     */
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description = "主键")
    private Long id;

    /**
     * 原合同编号
     */
    @Schema(description = "原合同编号")
    private String oldCode;

    /**
     * 合同编号
     */
    @Schema(description = "合同编号")
    private String code;

    /**
     * 合同名称
     */
    @Schema(description = "合同名称")
    private String name;

    /**
     * 租赁起始日期
     */
    @Schema(description = "租赁起始日期")
    private LocalDate startDate;

    /**
     * 租赁结束日期
     */
    @Schema(description = "租赁结束日期")
    private LocalDate endDate;

    /**
     * 建筑面积
     */
    @Schema(description = "建筑面积")
    private BigDecimal floorArea = BigDecimal.ZERO;

    /**
     * 租赁面积
     */
    @Schema(description = "租赁面积")
    private BigDecimal useArea = BigDecimal.ZERO;

    /**
     * 应收金额
     */
    @Schema(description = "应收金额")
    private BigDecimal mustAmt = BigDecimal.ZERO;

    /**
     * 实收金额
     */
    @Schema(description = "实收金额")
    private BigDecimal paiedAmt = BigDecimal.ZERO;

    /**
     * 核销金额
     */
    @Schema(description = "核销金额")
    private BigDecimal checkAmt = BigDecimal.ZERO;

    /**
     * 免收金额
     */
    @Schema(description = "免收金额")
    private BigDecimal backAmt = BigDecimal.ZERO;

    /**
     * 保证金
     */
    @Schema(description = "保证金")
    private BigDecimal foregift = BigDecimal.ZERO;

    /**
     * 实收保证金
     */
    @Schema(description = "实收保证金")
    private BigDecimal paiedForegift = BigDecimal.ZERO;

    /**
     * 核销保证金
     */
    @Schema(description = "核销保证金")
    private BigDecimal checkForegift = BigDecimal.ZERO;

    /**
     * 基础年租金
     */
    @Schema(description = "基础年租金")
    private BigDecimal annualAmt = BigDecimal.ZERO;

    /**
     * 装修开始日期
     */
    @Schema(description = "装修开始日期")
    private LocalDate renoStartDate;

    /**
     * 装修结束日期
     */
    @Schema(description = "装修结束日期")
    private LocalDate renoEndDate;

    /**
     * 装修天数
     */
    @Schema(description = "装修天数")
    private Integer renoDays;

    /**
     * 承租户姓名
     */
    @Schema(description = "承租户姓名")
    private String lesseeName;

    /**
     * 承租户手机号
     */
    @Schema(description = "承租户手机号")
    private String lesseeTelephone;

    /**
     * 承租户证件号
     */
    @Schema(description = "承租户证件号")
    private String lesseeIdcard;

    /**
     * 催缴方式
     */
    @Schema(description = "催缴方式")
    private String callType;

    /**
     * 合同状态
     */
    @Schema(description = "合同状态")
    private String status;

    /**
     * 支付周期
     */
    @Schema(description = "支付周期")
    private String payCycle;

    /**
     * 添加类型
     */
    @Schema(description = "添加类型")
    private String addType;

    /**
     * 文件
     */
    @Schema(description = "文件")
    private String file;

    /**
     * 合同其他条款
     */
    @Schema(description = "合同其他条款")
    private String term;

    /**
     * 备注
     */
    @Schema(description = "备注")
    private String remark;

    /**
     * 退费金额
     */
    @Schema(description = "退费金额")
    private BigDecimal refundAmt;

    /**
     * 实退金额
     */
    @Schema(description = "实退金额")
    private BigDecimal paiedRefundAmt;

    /**
     * 核销实退金额
     */
    @Schema(description = "核销实退金额")
    private BigDecimal checkRefundAmt;

    /**
     * 退租日期
     */
    @Schema(description = "退租日期")
    private LocalDateTime refundDate;

    /**
     * 退款收款人
     */
    @Schema(description = "退款收款人")
    private String refundAccountHolder;

    /**
     * 退款收款账户
     */
    @Schema(description = "退款收款账户")
    private String refundAccount;

    /**
     * 退费状态
     */
    @Schema(description = "退费状态")
    private String refundStatus;

    /**
     * 退费备注
     */
    @Schema(description = "退费备注")
    private String refundRemak;

    /**
     * 退费文件
     */
    @Schema(description = "退费文件")
    private String refundFile;

    /**
     * 创建人
     */
    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建人")
    private String createBy;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    /**
     * 更新人
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "更新人")
    private String updateBy;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

    /**
     * 删除标记[0未删除，1已删]
     */
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "删除标记[0未删除，1已删]")
    private String delFlag;

    /**
     * 租户号
     */
    @Schema(description = "租户号")
    private Long tenantId;

    @ExcelIgnore
    @TableField(exist = false)
    @EntityMapping(thisField = "id", joinField = "contractId")
    private List<ContractHouseEntity> contractHouseList;

    @ExcelIgnore
    @TableField(exist = false)
    @EntityMapping(thisField = "id", joinField = "contractId")
    private List<ContractLesseeEntity> contractLesseeList;
}